<?php

namespace app\admin\model;

use think\Model;


class Assignsuperiors extends Model
{

    

    

    // 表名
    protected $name = 'user_details';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'role_text',
        'login_status_text'
    ];



    public function getRoleList()
    {
        return ['agent' => __('Role Agent'), 'room' => __('Role Room')];
    }


    public function getLoginStatusList()
    {
        return ['正常' => __('正常'), '停用' => __('停用')];
    }


    public function getRoleTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['role']) ? $data['role'] : '');
        $list = $this->getRoleList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getLoginStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['login_status']) ? $data['login_status'] : '');
        $list = $this->getLoginStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
